<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<!--view-->
		<div id="app">

			<h3 v-if="tab==1">首页</h3>
			<h3 v-else-if="tab==2">新闻页</h3>
			<h3 v-else>个人中心</h3>
			<button @click="tabChange" data-id="1">首页</button>
			<button @click="tabChange" data-id="2">新闻页</button>
			<button @click="tabChange" data-id="3">个人中心</button>
		</div>

		<script type="text/javascript">
			let app = new Vue({
				el: "#app",
				data: {
					username: "小鸣鸣",
					isVip: false,
					age:25,
					tab:1
				},methods:{
					tabChange:function(e){
						let tabid=e.target.dataset.id;
						
						this.tab=tabid;
						console.log(e)
					}
				}
			})
		</script>
	</body>
</html>
